package thread.createThread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class ImplCallable {
  public static void main(String[] args) throws ExecutionException, InterruptedException {
    FutureTask<String> stringFutureTask = new FutureTask<String>(new selfImplCallable());

    new Thread(stringFutureTask,"笑了").start();

    System.out.println(stringFutureTask.get());
  }

  public static class selfImplCallable implements Callable{
    @Override
    public Object call() throws Exception {
      System.out.println("我在callable里面的线程兄弟们");
      return "这是callable的返回结果";
    }
  }
}
